package com.zxing.spring.provider.service;

import com.zxing.spring.provider.entity.ThingEntity;
import com.zxing.spring.provider.dao.ThingDao;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class HiService {

    @Value("${person.name}")
    private String name;

    @Autowired
    private ThingDao thingDao;

    @GlobalTransactional(rollbackFor = Exception.class)
    public String thing(){
        ThingEntity thing = new ThingEntity();
        thing.setName(name);
        thingDao.insert(thing);
        return name;
    }
}
